import service from '@/axios/http'
import { TableIResponse } from '@/utils/Api'
import { ProducerLedgerType } from './type'
export class ProducerLedgerApi {
  //查询厂商台账列表
  async GetProducerLedger(params: any): Promise<TableIResponse<ProducerLedgerType[]>> {
    const result = (await service.get('/api/patrol/producerLedger/list', {
      params
    })) as unknown as any
    return result
  }
  //删除厂商台账
  async DeletProducerLedger(uuids: string): Promise<boolean> {
    const result = (await service.delete(`/api/patrol/producerLedger/${uuids}`)) as unknown as any
    console.log(result)

    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //新增厂商台账
  async AddProducerLedger(data: ProducerLedgerType): Promise<boolean> {
    const result = (await service.post('/api/patrol/producerLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //修改厂商台账
  async EditProducerLedger(data: ProducerLedgerType): Promise<boolean> {
    const result = (await service.put('/api/patrol/producerLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
}
export default new ProducerLedgerApi()
